﻿using Serilog.Core;
using Serilog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;

namespace Core.Log
{
    public static class ExLog
    {
        //Log等级 trace - debug - info - error - fatal
        private static string CoreLogformat = @"[Engine] {Timestamp:yyyy-MM-dd HH:mm-dd}[{Level:u5}]{Message:lj}{NewLine}";
        private static string ClientLogformat = @"[Client] {Timestamp:yyyy-MM-dd HH:mm-dd}[{Level:u5}]{Message:lj}{NewLine}";

        private static readonly Logger CoreLogger;
        private static readonly Logger ClientLogger;
        static ExLog()
        {
            CoreLogger = new LoggerConfiguration().MinimumLevel.Debug()
                .WriteTo.Console(outputTemplate: CoreLogformat).CreateLogger();
            ClientLogger = new LoggerConfiguration().MinimumLevel.Debug()
                .WriteTo.Console(outputTemplate: ClientLogformat).CreateLogger();
        }
        public static void DebugLogCore(string message) => CoreLogger.Debug(message);
        public static void InfoLogCore(string message) => CoreLogger.Information(message);
        public static void ErrorLogCore(string message)=> CoreLogger.Error(message);
        public static void FatalLogCore(string message)=> CoreLogger.Fatal(message);
        public static void DebugLogClient(string message) => ClientLogger.Debug(message);
        public static void InfoLogClient(string message) => ClientLogger.Information(message);
        public static void ErrorLogClient(string message) => ClientLogger.Error(message);
        public static void FatalLogClient(string message) => ClientLogger.Fatal(message);
    }
}
